<template>
  <div class="home-banner">
    <!-- 轮播图组件 -->
    <XtxSlider :data="bannerList" autoPlay></XtxSlider>
  </div>
</template>

<script>
import { findBanner } from '@/api/home'
import { onMounted, ref } from 'vue'
export default {
  name: 'HomeBanner',
  setup() {
    const bannerList = ref([])
    // 封装请求函数
    async function loadBannerList() {
      // 参数修改
      const res = await findBanner()
      bannerList.value = res
    }
    onMounted(() => {
      // 调用函数
      loadBannerList()
    })
    return {
      bannerList,
    }
  },
}
</script>

<style scoped lang="less">
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
}
</style>
